home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
misc
/
date.lha
/
Date
/
M2
/
txt
/
testDate.mod
< prev
next >
Wrap
Text File
|
1994-08-11
|
14KB
|
380 lines
MODULE test;
FROM InOut IMPORT WriteInt,WriteCard,WriteString,WriteLn,
ReadCard,ReadInt,ReadLongCard;
FROM RealInOut IMPORT WriteReal,ReadReal;
IMPORT Date;
PROCEDURE readintyear() : INTEGER;
VAR
year : INTEGER;
BEGIN
WriteString("(integer)year: "); ReadInt(year);
RETURN(year);
END readintyear;
PROCEDURE readshortcardmonth() : SHORTCARD;
VAR
month : CARDINAL;
BEGIN
WriteString("(shortcard)month: "); ReadCard(month);
RETURN(SHORTCARD(month));
END readshortcardmonth;
PROCEDURE readshortcardday() : SHORTCARD;
VAR
day : CARDINAL;
BEGIN
WriteString("(shortcard)day: "); ReadCard(day);
RETURN(SHORTCARD(day));
END readshortcardday;
PROCEDURE readweekday() : Date.Weekdays;
VAR
wday : CARDINAL;
BEGIN
REPEAT
WriteString("weekday: 1=Monday; ...7=Sunday: "); ReadCard(wday);
UNTIL wday < 8;
RETURN(Date.Weekdays(wday));
END readweekday;
PROCEDURE readintdays() : INTEGER;
VAR
days : INTEGER;
BEGIN
WriteString("(integer)days: "); ReadInt(days);
RETURN(days);
END readintdays;
PROCEDURE readcardyear() : CARDINAL;
VAR
year : CARDINAL;
BEGIN
WriteString("(cardinal)year: "); ReadCard(year);
RETURN(year);
END readcardyear;
PROCEDURE readlongcarddays() : LONGCARD;
VAR
day : LONGCARD;
BEGIN
WriteString("(longcard)days: "); ReadLongCard(day);
RETURN(day);
END readlongcarddays;
PROCEDURE readshortcardhour() : SHORTCARD;
VAR
hour : CARDINAL;
BEGIN
WriteString("(shortcard)hour: "); ReadCard(hour);
RETURN(SHORTCARD(hour));
END readshortcardhour;
PROCEDURE readshortcardmin() : SHORTCARD;
VAR
min : CARDINAL;
BEGIN
WriteString("(shortcard)min: "); ReadCard(min);
RETURN(SHORTCARD(min));
END readshortcardmin;
PROCEDURE readshortcardsec() : SHORTCARD;
VAR
sec : CARDINAL;
BEGIN
WriteString("(shortcard)sec: "); ReadCard(sec);
RETURN(SHORTCARD(sec));
END readshortcardsec;
PROCEDURE readrealtime() : REAL;
VAR
jd : REAL;
BEGIN
WriteString("(real)time: "); ReadReal(jd);
RETURN(jd);
END readrealtime;
PROCEDURE readshortintdegree() : SHORTINT;
VAR
degree : INTEGER;
BEGIN
WriteString("(shortint)degree: "); ReadInt(degree);
RETURN(SHORTINT(degree));
END readshortintdegree;
PROCEDURE readlongcardsecs() : LONGCARD;
VAR
secs : LONGCARD;
BEGIN
WriteString("(longcard)secs: "); ReadLongCard(secs);
RETURN(secs);
END readlongcardsecs;
PROCEDURE readrealmeridian() : REAL;
VAR
jd : REAL;
BEGIN
WriteString("(real)meridian: "); ReadReal(jd);
RETURN(jd);
END readrealmeridian;
PROCEDURE readrealpos() : REAL;
VAR
jd : REAL;
BEGIN
WriteString("(real)ps: "); ReadReal(jd);
RETURN(jd);
END readrealpos;
VAR
input,repeat : CARDINAL;
wd : Date.Weekdays;
d,m,h,s : SHORTCARD;
y : INTEGER;
BEGIN
REPEAT
WriteString("----------------------------------------------------------------\n");
WriteString("01 : JulianLeapYear | 02 : GregorianLeapYear\n");
WriteString("03 : HeisLeapYear | 04 : JulianMonthDays\n");
WriteString("05 : GregorianMonthDays | 06 : HeisMonthDays\n");
WriteString("07 : JulianYearDays | 08 : GregorianYearDays\n");
WriteString("09 : HeisYearDays | 10 : JulianDayDiff\n");
WriteString("11 : GregorianDayDiff | 12 : HeisDayDiff\n");
WriteString("13 : JulianDaySmaller | 14 : GregorianDaySmaller\n");
WriteString("15 : HeisDaySmaller | 16 : JulianWeekday\n");
WriteString("17 : GregorianWeekday | 18 : HeisWeekday\n");
WriteString("19 : JulianDaysBeforeWeekday | 20 : GregorianDaysBeforeWeekday\n");
WriteString("21 : HeisDaysBeforeWeekday | 22 : JulianDaysAfterWeekday\n");
WriteString("23 : GregorianDaysAfterWeekday | 24 : HeisDaysAfterWeekday\n");
WriteString("25 : JulianDiffDate | 26 : GregorianDiffDate\n");
WriteString("27 : HeisDiffDate | 28 : JYearToScaliger\n");
WriteString("29 : GYearToScaliger | 30 : HYearToScaliger\n");
WriteString("31 : ScaligerYearToJ | 32 : ScaligerYearToG\n");
WriteString("33 : ScaligerYearToH | 34 : JSYearToJD\n");
WriteString("35 : GSYearToJD | 36 : HSYearToJD\n");
WriteString("37 : JDtoMJD | 38 : MJDtoJD\n");
WriteString("39 : JulianToJD | 40 : GregorianToJD\n");
WriteString("41 : HeisToJD | 42 : TimeToJD\n");
WriteString("43 : JDToTime | 44 : GregorianMoonAge\n");
WriteString("45 : GregorianEaster | 46 : TimeZoneFactor\n");
WriteString("47 : LMT | 48 : TimeToSec\n");
WriteString("49 : SecToTime | 50 : JulianWeek\n");
WriteString("51 : GregorianWeek | 52 : HeisWeek\n");
WriteString("00 : Quit\n");
WriteString("It's your turn: "); ReadCard(input);
WriteString("----------------------------------------------------------------\n");
REPEAT
CASE input OF
0 : ;|
1 : IF Date.JulianLeapYear(readintyear()) THEN
WriteString("TRUE\n");;
ELSE
WriteString("FALSE\n");
END;|
2 : IF Date.GregorianLeapYear(readintyear()) THEN
WriteString("TRUE\n");;
ELSE
WriteString("FALSE\n");
END;|
3 : IF Date.HeisLeapYear(readintyear()) THEN
WriteString("TRUE\n");;
ELSE
WriteString("FALSE\n");
END;|
4 : WriteCard(Date.JulianMonthDays(readshortcardmonth(),readintyear()),3);
WriteLn;|
5 : WriteCard(Date.GregorianMonthDays(readshortcardmonth(),readintyear()),3);
WriteLn;|
6 : WriteCard(Date.HeisMonthDays(readshortcardmonth(),readintyear()),3);
WriteLn;|
7 : WriteCard(Date.JulianYearDays(readintyear()),4);
WriteLn;|
8 : WriteCard(Date.GregorianYearDays(readintyear()),4);
WriteLn;|
9 : WriteCard(Date.HeisYearDays(readintyear()),4);
WriteLn;|
10 : WriteInt(Date.JulianDayDiff(readshortcardday(),readshortcardmonth(),readintyear(),readshortcardday(),readshortcardmonth(),readintyear()),10);
WriteLn;|
11 : WriteInt(Date.GregorianDayDiff(readshortcardday(),readshortcardmonth(),readintyear(),readshortcardday(),readshortcardmonth(),readintyear()),10);
WriteLn;|
12 : WriteInt(Date.HeisDayDiff(readshortcardday(),readshortcardmonth(),readintyear(),readshortcardday(),readshortcardmonth(),readintyear()),10);
WriteLn;|
13 : IF Date.JulianDaySmaller(readshortcardday(),readshortcardmonth(),readintyear(),readshortcardday(),readshortcardmonth(),readintyear()) THEN
WriteString("TRUE\n");
ELSE
WriteString("FALSE\n");
END;|
14 : IF Date.GregorianDaySmaller(readshortcardday(),readshortcardmonth(),readintyear(),readshortcardday(),readshortcardmonth(),readintyear()) THEN
WriteString("TRUE\n");
ELSE
WriteString("FALSE\n");
END;|
15 : IF Date.HeisDaySmaller(readshortcardday(),readshortcardmonth(),readintyear(),readshortcardday(),readshortcardmonth(),readintyear()) THEN
WriteString("TRUE\n");
ELSE
WriteString("FALSE\n");
END;|
16 : wd := Date.JulianWeekday(readshortcardday(),readshortcardmonth(),readintyear());
CASE wd OF
Date.dayerr : WriteString("dayerr!\n");|
Date.Monday : WriteString("Monday\n");|
Date.Tuesday : WriteString("Tuesday\n");|
Date.Wednesday : WriteString("Wednesday\n");|
Date.Thursday : WriteString("Thursday\n");|
Date.Friday : WriteString("Friday\n");|
Date.Saturday : WriteString("Saturday\n");|
Date.Sunday : WriteString("Sunday\n");
ELSE
WriteString("Illegal Code!\n");
END;|
17 : wd := Date.GregorianWeekday(readshortcardday(),readshortcardmonth(),readintyear());
CASE wd OF
Date.dayerr : WriteString("dayerr!\n");|
Date.Monday : WriteString("Monday\n");|
Date.Tuesday : WriteString("Tuesday\n");|
Date.Wednesday : WriteString("Wednesday\n");|
Date.Thursday : WriteString("Thursday\n");|
Date.Friday : WriteString("Friday\n");|
Date.Saturday : WriteString("Saturday\n");|
Date.Sunday : WriteString("Sunday\n");
ELSE
WriteString("Illegal Code!\n");
END;|
18 : wd := Date.HeisWeekday(readshortcardday(),readshortcardmonth(),readintyear());
CASE wd OF
Date.dayerr : WriteString("dayerr!\n");|
Date.Monday : WriteString("Monday\n");|
Date.Tuesday : WriteString("Tuesday\n");|
Date.Wednesday : WriteString("Wednesday\n");|
Date.Thursday : WriteString("Thursday\n");|
Date.Friday : WriteString("Friday\n");|
Date.Saturday : WriteString("Saturday\n");|
Date.Sunday : WriteString("Sunday\n");
ELSE
WriteString("Illegal Code!\n");
END;|
19 : WriteCard(Date.JulianDaysBeforeWeekday(readshortcardday(),readshortcardmonth(),readintyear(),readweekday()),2);
WriteLn;|
20 : WriteCard(Date.GregorianDaysBeforeWeekday(readshortcardday(),readshortcardmonth(),readintyear(),readweekday()),2);
WriteLn;|
21 : WriteCard(Date.HeisDaysBeforeWeekday(readshortcardday(),readshortcardmonth(),readintyear(),readweekday()),2);
WriteLn;|
22 : WriteCard(Date.JulianDaysAfterWeekday(readshortcardday(),readshortcardmonth(),readintyear(),readweekday()),2);
WriteLn;|
23 : WriteCard(Date.GregorianDaysAfterWeekday(readshortcardday(),readshortcardmonth(),readintyear(),readweekday()),2);
WriteLn;|
24 : WriteCard(Date.HeisDaysAfterWeekday(readshortcardday(),readshortcardmonth(),readintyear(),readweekday()),2);
WriteLn;|
25 : Date.JulianDiffDate(readshortcardday(),readshortcardmonth(),readintyear(),readintdays(),d,m,y);
WriteCard(d,2); WriteString("."); WriteCard(m,2); WriteString("."); WriteInt(y,4); WriteLn;|
26 : Date.GregorianDiffDate(readshortcardday(),readshortcardmonth(),readintyear(),readintdays(),d,m,y);
WriteCard(d,2); WriteString("."); WriteCard(m,2); WriteString("."); WriteInt(y,4); WriteLn;|
27 : Date.HeisDiffDate(readshortcardday(),readshortcardmonth(),readintyear(),readintdays(),d,m,y);
WriteCard(d,2); WriteString("."); WriteCard(m,2); WriteString("."); WriteInt(y,4); WriteLn;|
28 : WriteCard(Date.JYearToScaliger(readintyear()),10);
WriteLn;|
29 : WriteCard(Date.GYearToScaliger(readintyear()),10);
WriteLn;|
30 : WriteCard(Date.HYearToScaliger(readintyear()),10);
WriteLn;|
31 : WriteInt(Date.ScaligerYearToJ(readcardyear()),5);
WriteLn;|
32 : WriteInt(Date.ScaligerYearToG(readcardyear()),5);
WriteLn;|
33 : WriteInt(Date.ScaligerYearToH(readcardyear()),5);
WriteLn;|
34 : WriteCard(Date.JSYearToJD(readcardyear()),10);
WriteLn;|
35 : WriteCard(Date.GSYearToJD(readcardyear()),10);
WriteLn;|
36 : WriteCard(Date.HSYearToJD(readcardyear()),10);
WriteLn;|
37 : WriteCard(Date.JDtoMJD(readlongcarddays()),10);
WriteLn;|
38 : WriteCard(Date.MJDtoJD(readlongcarddays()),10);
WriteLn;|
39 : WriteCard(Date.JulianToJD(readshortcardday(),readshortcardmonth(),readintyear()),10);
WriteLn;|
40 : WriteCard(Date.GregorianToJD(readshortcardday(),readshortcardmonth(),readintyear()),10);
WriteLn;|
41 : WriteCard(Date.HeisToJD(readshortcardday(),readshortcardmonth(),readintyear()),10);
WriteLn;|
42 : WriteReal(Date.TimeToJD(readshortcardhour(),readshortcardmin(),readshortcardsec()),20,10);
WriteLn;|
43 : Date.JDToTime(readrealtime(),h,m,s);
WriteCard(h,2); WriteString(":"); WriteCard(m,2); WriteString(":"); WriteCard(s,2); WriteLn;|
44 : WriteCard(Date.GregorianMoonAge(readshortcardday(),readshortcardmonth(),readintyear()),2);
WriteLn;|
45 : Date.GregorianEaster(readintyear(),d,m);
WriteCard(d,2); WriteString("."); WriteCard(m,2); WriteString("."); WriteLn;|
46 : WriteInt(Date.TimeZoneFactor(readshortintdegree()),2); WriteLn;|
47 : WriteInt(Date.LMT(readlongcardsecs(),readrealmeridian(),readrealpos()),10); WriteLn;|
48 : WriteCard(Date.TimeToSec(readshortcardhour(),readshortcardmin(),readshortcardsec()),10); WriteLn;|
49 : Date.SecToTime(readlongcardsecs(),h,m,s);
WriteCard(h,2); WriteString(":"); WriteCard(m,2); WriteString(":"); WriteCard(s,2); WriteLn;|
50 : WriteCard(Date.JulianWeek(readshortcardday(),readshortcardmonth(),readintyear()),2); WriteLn;|
51 : WriteCard(Date.GregorianWeek(readshortcardday(),readshortcardmonth(),readintyear()),2); WriteLn;|
52 : WriteCard(Date.HeisWeek(readshortcardday(),readshortcardmonth(),readintyear()),2); WriteLn;
ELSE
WriteString("Wong number! Try again!\n");
END;
IF input > 0 THEN
WriteString("0 : Menue; >0 : test again - ");
ReadCard(repeat);
ELSE
repeat := 0;
END;
UNTIL repeat = 0;
UNTIL input = 0;
END test.